var login=document.getElementById('login');
var entry = document.getElementById('huawei-entry');

login.onclick = function(){
	entry.style.visibility = 'visible';

}


var deletex = document.getElementById('deletex');
deletex.onclick = function(){
	entry.style.visibility = 'hidden';
}


// var deletex = document.getElementById('deletex');
// deletex.onclick = function(){
// 	mains.style.visibility = 'hidden';
// }
// 图层拖拽
moves.onmousedown = function( event ){

	var event = event || window.event; // 兼容IE
	var left = event.offsetX;
	var top = event.offsetY;

	document.onmousemove = function( en ){

		var en = en || window.event;
		var x = en.x - left;
		var y = en.y - top;

		move.style.left = x + 'px';
		move.style.top = y + 'px';
	}

}

moves.onmouseup = function(en){
	document.onmousemove = null;

}



// 表单验证
function checkName(){
	value = document.regForm.username.value;

	res = value.match(/^1(3\d|4[56789]|5[012356789]|66|7[0345678]|8\d|9[89])\d{8}$/);
	if(res == null){
		notice1.innerHTML = '用户名格式不正确';
		notice1.style.color = 'red';
		notice10.style.display = 'none';
		return false;
	}else{
		notice10.style.display = 'block';
		return true;
	}
}


function checkEmail(){
	value = document.regForm.useremail.value;

	res = value.match( /^[\da-zA-Z]{5,15}@[a-zA-Z]{1,10}\.(com|cn|net|edu|org)$/);

	if(res == null){
		return false;
	}else{
		notice20.style.display = 'block';
		return true;
	}
}
function checkPass(){
	value = document.regForm.pass.value;

	res = value.match( /^.{6,18}$/);
	a = value.match( /\d/ );
	b = value.match( /[a-zA-Z]/ )

	if(res == null){
		notice3.innerHTML = '密码长度不正确';
		notice30.style.display = 'none';
		notice3.style.color = 'red';
		return false;
	}else if( a && b  ){
		notice30.style.display = 'block';
		return true;
	}else{
		notice3.innerHTML = '密码格式不正确';
		notice30.style.display = 'none';
		notice3.style.color = 'red';
		return false;
	}
}


function checkRepass(){
	pass = document.regForm.pass.value;

	repass = document.regForm.repass.value;


	if(pass != repass){
		notice4.innerHTML = '两次密码不一致';
		notice4.style.color = 'red';
		notice40.style.display = 'none';
		return false;
	}else if(repass == ''){
		notice4.innerHTML = '';
		notice4.style.color = 'red';
		return false;
	}else{
		notice40.style.display = 'block';
		return true;
	}
}

function checkForm(){

	return checkRepass() && checkPass() && checkEmail() && checkName();

}

// 点击继续
function checkPass1(){
		notice3.innerHTML = '';
}

function checkRepass1(){

		notice4.innerHTML = '';
}

function checkName1(){
		notice1.innerHTML = '';
}

function checkEmail1(){
		notice2.innerHTML = '';
}






